package com.abel.domain.types;

public enum UserType {
	
	APPLICANT ("R",1,"RUSER", "Regular User - Applicant"),
	SUPERADMIN("S",2,"SUSER","Super User"),
	ADMIN ("A",3,"AUSER","Admin User"),
	EMPLOYEE("E", 4, "EUSER", "Employee");
	
	private String userTypeAbbrivCode;
	private int userTypeId;
	private String userTypeCode;
	private String userTypeDesc;
	
	
	private UserType(String userTypeAbbrivCode, int userTypeId, String userTypeCode, String userTypeDesc) {
		this.userTypeAbbrivCode = userTypeAbbrivCode;
		this.userTypeId = userTypeId;
		this.userTypeCode = userTypeCode;
		this.userTypeDesc = userTypeDesc;
	}
	
	public String getUserTypeCode() {
		return this.userTypeCode;
	}
	
	public String getuserTypeAbbrivCode() {
		return this.userTypeAbbrivCode;
	}
	
	public int getUserTypeId() {
		return this.userTypeId;
	}
	
	public String getUserTypeDesc() {
		return this.userTypeDesc;
	}
	
	public static String getUserTypeCode(String userTypeAbbrivCode) {
		for (UserType userType : UserType.values()) {
			if (userType.userTypeAbbrivCode.equalsIgnoreCase(userTypeAbbrivCode)) {
				return userType.userTypeCode;
			}
		}
		return null;
	}
	
	
	public static int getUserTypeId(String userTypeAbbrivCode) {
		for (UserType userType : UserType.values()) {
			if (userType.userTypeAbbrivCode.equalsIgnoreCase(userTypeAbbrivCode)) {
				return userType.userTypeId;
			}
		}
		return -1;
	}
}
